home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / WWW / Perl_WWW_Utilities / perlMIF_beta2 / mif / mif_units.pl < prev    next >
Encoding:
Perl Script  |  1994-05-18  |  3.1 KB  |  87 lines

  1. ##---------------------------------------------------------------------------##
  2. ##  File:
  3. ##      mif_units.pl
  4. ##  Author:
  5. ##      Earl Hood       ehood@convex.com
  6. ##  Description:
  7. ##    This file is defines the "mif_units" perl package.  It defines
  8. ##    routines to handle the Units statement via MIFread_mif() defined in
  9. ##    the "mif" package.
  10. ##---------------------------------------------------------------------------##
  11. ##  Copyright (C) 1994  Earl Hood, ehood@convex.com
  12. ##
  13. ##  This program is free software; you can redistribute it and/or modify
  14. ##  it under the terms of the GNU General Public License as published by
  15. ##  the Free Software Foundation; either version 2 of the License, or
  16. ##  (at your option) any later version.
  17. ## 
  18. ##  This program is distributed in the hope that it will be useful,
  19. ##  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. ##  GNU General Public License for more details.
  22. ##  
  23. ##  You should have received a copy of the GNU General Public License
  24. ##  along with this program; if not, write to the Free Software
  25. ##  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. ##---------------------------------------------------------------------------##
  27.  
  28. require 'mif/mif.pl' || die "Unable to require mif.pl\n";
  29.  
  30. package mif_units;
  31.  
  32. ##-------------------------------------------------##
  33. ## Add Units function to %MIFToken array ##
  34. ##-------------------------------------------------##
  35. $mif'MIFToken{'Units'} = 'Units';
  36.  
  37. ##----------------------------------------##
  38. ## Variable that stores the defaule units ##
  39. ##----------------------------------------##
  40. $Units = 'Uin';
  41.  
  42. ##------------------------##
  43. ## Import 'mif' variables ##
  44. ##------------------------##
  45. $MStore        = $mif'MStore;
  46. $MOpen        = $mif'MOpen;
  47. $MClose        = $mif'MClose;
  48. $MLine        = $mif'MLine;
  49. $mso        = $mif'mso;
  50. $msc        = $mif'msc;
  51. $stb        = $mif'stb;
  52. $ste        = $mif'ste;
  53. $como        = $mif'como;
  54.  
  55.                 ##---------------##
  56.                 ## Main Routines ##
  57.                 ##---------------##
  58. ##---------------------------------------------------------------------------
  59. ##    MIFwrite_units() outputs the <Units> statement with the units defined
  60. ##    by $Units.
  61. ##
  62. sub main'MIFwrite_units {
  63.     local($handle, $l) = @_;
  64.     local($i0) = (' ' x $l);
  65.  
  66.     print $handle $i0, $mso, 'Units', ' ', $Units, $msc, "\n";
  67. }
  68. ##---------------------------------------------------------------------------##
  69.                 ##--------------##
  70.                 ## Mif Routines ##
  71.                 ##--------------##
  72. ##---------------------------------------------------------------------------##
  73. ##    The routines definded below are all registered in the %MIFToken         ##
  74. ##    array for use in the read_mif() routine.  There purpose is to         ##
  75. ##    store the information contained in the Units statement.             ##
  76. ##---------------------------------------------------------------------------##
  77.  
  78. ##---------------------------------------------------------------------------
  79. sub mif'Units {
  80.     local($token, $mode, *data) = @_;
  81.     if ($data !~ /^\s*$/) {
  82.     ($Units) = $data =~ /^\s*(\S*)/o;
  83.     }
  84. }
  85. ##---------------------------------------------------------------------------
  86. 1;
  87.